import request from '@/utils/axios';

import { ClientWebModuleVO } from './types';

export const listAllTreeApi = () => {
  return request.post<ClientWebModuleVO[]>({
    url: '/tenant/clientWebModule/listAllTree',
  });
};

export const getApi = (id: string) => {
  return request.get<ClientWebModuleVO>({
    url: '/tenant/clientWebModule/get/' + id,
  });
};

export const getFullPathApi = (id: string) => {
  return request.get<string>({
    url: '/tenant/clientWebModule/getFullPath/' + id,
  });
};

export const saveApi = (data: ClientWebModuleVO) => {
  return request.post({ url: '/tenant/clientWebModule/save', data });
};

export const updateApi = (data: ClientWebModuleVO) => {
  return request.post({ url: '/tenant/clientWebModule/update', data });
};

export const removeApi = (id?: string) => {
  return request.post({
    url: '/tenant/clientWebModule/remove',
    params: { id },
  });
};
